package Operation;

import java2021_9_23.Book;
import java2021_9_23.BookDao;

import java.util.List;
import java.util.Scanner;

public class FindOperation implements IOperation{
    @Override
    public void work() {
        System.out.println("查找指定书籍");
        BookDao bookDao = new BookDao();
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你想要查找的书籍名字:>");
        String name = scanner.next();
        List<Book> books = bookDao.selectBook(name);
        System.out.println(books);
        //下面才是正确的,因为有多个对象的话,就有可能会出错?? 如果是数字的话,直接对二维数组进行打印,则会打印的是地址,但上面缺确实打印出所想要的值.
//        List<Book> books = bookDao.selectByName(bookName);
//        for (Book book: books) {
//            System.out.println(book);
//        }
//        System.out.println("根据名字查找书籍完毕!");
    }
}
